package problema013;

import java.io.BufferedReader;
import java.io.FileReader;

public class Suma100numeros {
	static long res;
	static String[] vector = new String[100];
	
	public static void main(String[] args){
		System.out.println(suma());
	}

	public static long suma(){
		cargarVector();
		int suma = 0, carry = 0, sobra = 0;
		for(int j = 49; j >= 0; j--){
			for(int i = 0; i < vector.length; i++){
				suma += vector[i].charAt(j) - 48;
			}
			sobra = suma % 10;
			carry = (suma - sobra)/10;
			suma = carry;
			System.out.println(sobra);
		}
		System.out.println(carry);
		return carry;

	}
	
	public static void cargarVector(){
		try{
			BufferedReader reader = new BufferedReader( new FileReader("numerosEj13.txt") );
			String linea;
			int pos = 0;
			while ((linea = reader.readLine()) != null){
				vector[pos] = linea;
				pos ++;
			}
			reader.close();
			}catch (Exception e){
				System.err.println("Error: " + e.getMessage());
			}		
	}
	
}
